package com.hcloud.libupload.comom

import com.hcloud.libupload.utils.UploadUtils

class UploadLib {

    companion object {
        @Volatile
        private var instance: UploadLib? = null

        fun instance(): UploadLib = instance
            ?: synchronized(this) {
                return instance
                    ?: UploadLib().also {
                        instance = it
                    }
            }
    }

    lateinit var uploadConfig: UploadConfig

    lateinit var uploadAuth: String

    private var isInitOk = false

    fun init(uploadConfig: UploadConfig) {
        this.uploadConfig = uploadConfig
        uploadAuth =
            UploadUtils.getUploadAuth(uploadConfig.loginKey, uploadConfig.phone, uploadConfig.boxId)

        isInitOk = true
    }

    fun isInit() = isInitOk
}